package com.hit.aircraftwar.supply;

import com.hit.aircraftwar.aircraft.HeroAircraft;
import com.hit.aircraftwar.setter.ParameterSet;


/**
 * @author LiuYuZhe
 */
public class FireSupplyThread implements Runnable {

    private boolean willRestore = true;

    public void setWillRestore(boolean willRestore) {
        this.willRestore = willRestore;
    }

    @Override
    public void run() {
        synchronized (this) {
            int effect = 10;
            HeroAircraft.getInstance().addShootNum(effect);
            try {
                int effectTime = 15 * 1000;
                if(ParameterSet.INSTANCE.fireDouble) {
                    effectTime *= 2;
                }
                wait(effectTime);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(willRestore) {
                HeroAircraft.getInstance().restoreShootNum();
            }
        }
    }
}
